fix(connectors): follow-up hardening for callApi - #261
Merged
Conversation
- Percent-encode caller-supplied integration types and connector IDs in request URLs, so a runtime-built identifier can only select a connector, never re-target another route under the privileged token - Type ConnectorApiResponse.data as T | null to match the documented and implemented contract (null for binary and proxy-error responses) - Treat host: null like undefined when omitting the host field, since untyped callers write `host: x ?? null` - Add nock.disableNetConnect() to the proxy tests so interceptor mismatches fail fast instead of escaping as real network requests - Run test:types in CI so the type-contract tests are enforced Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.43-pr.261.f8cbcf8Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.43-pr.261.f8cbcf8"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.43-pr.261.f8cbcf8"
}
}
Preview published to npm registry — try new features instantly! |
DolevEpshtein
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #256, addressing the review findings that were worth fixing post-merge.
Changes
callApi(and the sibling connector methods, which shared the pattern) interpolated the integration type / connector ID into the URL unencoded, so a runtime-built string containing../could re-target a different API route while carrying the service-role token. Identifiers are now confined to their path segment. Covered by a new unit test.ConnectorApiResponse.datais nowT | null. The JSDoc and the implementation already returnednullfor binary responses (and proxy error details on failure), but an explicit type argument produced a non-nullable type that ends in a runtimeTypeError. Fixing this now, before external TS consumers depend on the old signature, keeps it from becoming a breaking change later. Covered by new type-contract assertions.host: nullis treated as unset. The omission check was=== undefined, so untyped JS callers writinghost: x ?? nullsent a literal"host": nullto the proxy, defeating the default-host fallback. Now checked with== null. Covered by a new test case.nock.disableNetConnect()in the proxy tests. The new test file was the only one missing it, so an interceptor mismatch escaped as a real HTTPS request to production instead of failing fast.npm run test:types. The type-contract tests added in feat(connectors): callApi for metered connectors #256 (including this PR's new assertions) were never enforced — no workflow invoked them.Testing
npm run test:types— cleannpm run test:unit— 223/223 passing🤖 Generated with Claude Code